<template>
  <ul class="appTab">
    <li v-for="(item, index) in tabList" :key="index" @click="tabcut(item)" :class="{active: item == $store.state.itemName}">{{ item }}</li>
  </ul>
</template>

<script>
import { ref, reactive, toRefs } from "vue";
import { useStore } from 'vuex';
export default {
  setup() {
    const store = useStore();
    const data = reactive({
      tabList: ["全部", "精华", "分享", "问答", "招聘", "客户端测试"],
    });
    const tabcut = (val) => {
       store.commit('storeCut', val);
    }
    return {
      ...toRefs(data),
      tabcut
    };
  },
};
</script>
<style lang="scss" scoped>
.appTab {
  display: flex;
  justify-content: space-around;
  font-size: 14px;
  color: rgb(99, 158, 11);
  height: 50px;
  align-items: center;
  background: #f5f5f5;
  li{
    padding: 3px 6px;
  }
  .active{
     background: rgb(99, 158, 11);
     color: #fff;
  }
}
</style>